home *** CD-ROM | disk | FTP | other *** search
- /* ###################################################################
-
- Bomb Shelter by Andrew Welch
-
- This INIT was written at the request of some of my shareware users.
- It simply patches _InitDialogs and inserts a ResumeProc if there
- isn't one specified.
-
- The ResumeProc simply does an _ExitToShell.
-
- ################################################################### */
-
-
- #define JMP 0x4EF9
- #define InitDialogsTrap 0xA97B
-
-
- main()
- {
- asm
- {
- lea @savedG,A1
- move.l A0, (A1)
- _RecoverHandle
- move.l A0,-(SP)
- _DetachResource
-
- /* Patch InitDialogs */
-
- move #InitDialogsTrap,D0
- _GetTrapAddress NEWTOOL
-
- lea @origInitDialogs,A1
- move #JMP,(A1)+
- move.l A0,(A1)
-
- move #InitDialogsTrap,D0
- lea @patchInitDialogs,A0
- _SetTrapAddress NEWTOOL
-
- /* Do the Show Icon code */
-
- clr.l -(SP)
- move.l #'Show',-(SP)
- move.w #0,-(SP)
- _GetResource
- tst.l (SP)
- move.l (SP)+,A0
- beq @skipShow
- lea @showCR,A1
- move.l A0,(A1)
- _HNoPurge
- _HLock
- move.l (A0),A0
- jsr (A0)
- move.l @showCR,A0
- _HPurge
- _HUnlock
-
- @skipShow
-
- rts
-
-
- /* ################################################################### */
-
- /* Here is our Resume Procedure */
-
- @ResumeProc
-
- _ExitToShell
-
-
- /* ################################################################### */
-
- /* Here is our patch to InitDialogs */
-
- @patchInitDialogs
-
- tst.l 4(SP)
- bne @alreadyInstalled
-
- lea @ResumeProc,A0
- move.l A0,4(SP)
-
- @alreadyInstalled
-
- @origInitDialogs
-
- nop
- nop
- nop
-
-
- /* ################################################################### */
-
- /* Static storage */
-
- @savedG dc.l 0 /* PTR to our code */
- @showCR dc.l 0 /* Holds the ShowIcon code handle */
- }
- }